package net.huashitong.Indicators.dao;

import com.sirdc.modules.core.dao.GenericQuery;
import com.sirdc.modules.core.dao.StringDao;
import net.huashitong.Indicators.entity.BA02;
import net.huashitong.Indicators.interfacedao.SequenceDao;
import org.hibernate.SQLQuery;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class BA02Dao extends StringDao<BA02> implements SequenceDao {


    public BA02 queryDate(String bab205)
    {
        GenericQuery query = createQuery("obj");
       /* query.append(" and obj.BAB201=:BAB201").setParam("BAB201",bab201);*/
        query.append(" and obj.BAB205=:BAB205").setParam("BAB205",bab205);
        query.append(" and obj.AAA100= '1' ");
       // BA02 list  = query.singleResult();
        return  query.singleResult();
    }

    @Override
    public String getSequence(String seqName) {
        String sql  = "select "+seqName+".nextval from dual ";
        SQLQuery query = getSession().createSQLQuery(sql);
        List list = query.list();
        list.get(0).toString();
        return list.get(0).toString();
    }
}
